package controllers

import "github.com/astaxie/beego"

//import (
//	"github.com/astaxie/beego"
//	"github.com/googollee/go-socket.io"
//	"log"
//	"net/http"
//)
//
// Operations about Chats
type ChatController struct {
	beego.Controller
}

//
//type Message struct {
//	Type    string `description:"0: 私聊 1: 聊天室"`
//	FromId  string `description:"发送者id"`
//	ToId    string `description:"发送到的聊天室或用户id"`
//	Content string `description:"发送的内容"`
//}
//
//
//// @Title CreateServer
//// @Description 创建Sever
//// @Success 200 {object} models.Company
//// @Failure 400 :body is empty
//// @router /create [post]
//func (c *ChatController) CreateServer(server *socketio.Server) {
//	_ = server.On("connection", func(so socketio.Socket) {
//		log.Println("on connection")
//		_ = so.On("join", func(companyId string) {
//			_ = so.Join(companyId)
//		})
//		_ = so.On("chat", func(msg Message) {
//			server.BroadcastTo(msg.ToId, "chat", msg)
//		})
//		_ = so.On("disconnection", func() {
//			log.Println("on disconnect")
//		})
//	})
//	_ = server.On("error", func(so socketio.Socket, err error) {
//		log.Println("error:", err)
//	})
//
//	http.Handle("/socket.io/", server)
//	log.Println("Serving at localhost:5000...")
//	log.Fatal(http.ListenAndServe(":5000", nil))
//}
